pub mod bunny;
//
pub mod back_test;
pub mod custom_types;
pub mod trade_api;
pub mod trade_engine;
use serde::Deserialize;
use serde::Serialize;
use ts_rs::TS;

// use crate::model::trade_order::TradeType;

// Define a TradeRequest enum to represent different actions
#[derive(Debug, Serialize, Deserialize, TS, Clone)]
#[ts(export)]
pub struct TradeRequest {
    // pub trade_type: TradeType,
    /// trade_bot_id ,
    pub trade_bot_id: String,
    /// trade_bot choose the kline to buy
    pub kline_id: String,
    /// the amount of stock to buy
    pub amount: i64,
}

impl TradeRequest {
    pub fn new_buy(trade_bot_id: &str, kline_id: String, amount: i64) -> Self {
        TradeRequest {
            // trade_type: TradeType::Buy,
            trade_bot_id: trade_bot_id.to_string(),
            kline_id,
            amount,
        }
    }

    pub fn new_sell(trade_bot_id: &str, kline_id: String, amount: i64) -> Self {
        TradeRequest {
            // trade_type: TradeType::Sell,
            trade_bot_id: trade_bot_id.to_string(),
            kline_id,
            amount,
        }
    }
}
